package cwnu.sapphire.com.entity;

import lombok.Data;

@Data
public class LoginResult {
    private Integer code; // 状态码：0-成功，1-密码错误，2-账号不存在
    private String message; // 消息
    private User user; // 用户信息（登录成功时返回）
    
    public LoginResult() {
    }
    
    public LoginResult(Integer code, String message, User user) {
        this.code = code;
        this.message = message;
        this.user = user;
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }
    
    public static LoginResult success(User user) {
        return new LoginResult(0, "登录成功", user);
    }
    
    public static LoginResult passwordError() {
        return new LoginResult(1, "密码错误", null);
    }
    
    public static LoginResult userNotFound() {
        return new LoginResult(2, "账号不存在", null);
    }
} 